#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {
    int i;
    int seed = 500;
    int numPlayer = 2;
    int p, r;
	int x,y;

    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;

	int villages[MAX_HAND];
	for (i = 0; i < MAX_HAND; i++) {
		villages[i] = village;
	}


	memset(&G, 23, sizeof(struct gameState));   // clear the game state
	r = initializeGame(numPlayer, k, seed, &G); // initialize a new game
	G.handCount[0] = 5; // set hand count
	memcpy(G.hand[0], villages, sizeof(int) * G.handCount[0]);  // sets all cards in hand to village

	#if (NOISY_TEST == 1)
		printf("Player 0: %d cards, %d actions\n", G.handCount[0], G.numActions);
		printf("TESTING VILLAGE WITH CARDEFFECT\n");
	#endif
	
	for (i = 0; i < 3; i++) { // test 3 times
		cardEffect(villages, -1, -1, -1, &G, -1, 0); // play village from THIN AIR

		#if (NOISY_TEST == 1)
			printf("Player 0: %d cards, %d actions\n", G.handCount[0], G.numActions);
		#endif
	}


	printf("\n");


	memset(&G, 23, sizeof(struct gameState));   // clear the game state
	r = initializeGame(numPlayer, k, seed, &G); // initialize a new game
	G.handCount[0] = 5; // set hand count

	#if (NOISY_TEST == 1)
		printf("Player 0: %d cards, %d actions\n", G.handCount[0], G.numActions);
		printf("TESTING VILLAGE WITH PLAYCARD\n");
	#endif
	
	for (i = 0; i < 3; i++) { // test 3 times
		memcpy(G.hand[0], villages, sizeof(int) * G.handCount[0]);  // sets all cards in hand to village
		playCard(0, -1, -1, -1, &G); // play a village card, +1 card + 2 actions

		#if (NOISY_TEST == 1)
			printf("Player 0: %d cards, %d actions\n", G.handCount[0], G.numActions);
		#endif
	}

    printf("\nAll village tests completed!\n");

    return 0;
}
